package com.springboot.mybatisplus.controller;

import com.springboot.mybatisplus.bean.Monster;
import com.springboot.mybatisplus.service.MonsterService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

@Controller
public class MonsterController {
    @Resource
    private MonsterService monsterService;

    @ResponseBody
    @GetMapping("/monster")
    public Monster getMonsterById(@RequestParam("id") String id) {
        return monsterService.getById(id);
    }
    @ResponseBody
    @GetMapping("/monsterlist")
    public List<Monster> getMonsterList() {
        return monsterService.list();
    }
}
